// ./mongodb/entity/articleModel.js
const mongoose = require("mongoose");

const merchantSchema = new mongoose.Schema(
  {
    merchantname: { type: String, required: true, unique: true }, // 商家名字
    erweimapic: { type: String }, // 商家二维码
    info: { type: String, required: true }, // 商家简介
    pictureurl: { type: String }, // 商家介绍图
    sort: { type: String, enum: ["美食", "商品", "客栈"], required: true }, // 商家分类
    town: { type: String, required: true }, // 商家所属小镇
    deleted: { type: Boolean, default: false }, // 删除标志
    isPublished: { type: Boolean, default: false }, // 发布状态，默认为未发布
  },
  {
    timestamps: true, // 使用默认的 createdAt 和 updatedAt 字段
  },
);

const MerchantModel = mongoose.model("Merchant", merchantSchema);

module.exports = MerchantModel;
